/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * AppFrame.java
 *
 * Created on Oct 22, 2014, 3:07:50 PM
 */
package com.ivanbiz.ui;

import com.ivanbiz.dao.AksesMatrixDAO;
import com.ivanbiz.dao.impl.AksesMatrixDAOImpl;
import com.ivanbiz.model.AksesMatrix;
import com.ivanbiz.model.Pengguna;
import com.ivanbiz.service.GlobalSession;
import com.ivanbiz.service.MenuAksesConstant;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JDialog;

/**
 *
 * @author IW20149X
 */
public class AppFrame extends javax.swing.JFrame {

    public AppFrame(Pengguna pengguna) {
        initComponents();
        renderMenuAkses(pengguna);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        layeredPane = new javax.swing.JLayeredPane();
        jMenuBar1 = new javax.swing.JMenuBar();
        menuApplikasi = new javax.swing.JMenu();
        menuItemKeluar = new javax.swing.JMenuItem();
        menuItemTutup = new javax.swing.JMenuItem();
        menuMaster = new javax.swing.JMenu();
        menuItemKos = new javax.swing.JMenuItem();
        menuItemKamar = new javax.swing.JMenuItem();
        menuItemFasilitas = new javax.swing.JMenuItem();
        menuItemInventory = new javax.swing.JMenuItem();
        menuItemPenghuni = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JPopupMenu.Separator();
        menuItemGLAccount = new javax.swing.JMenuItem();
        menuTransaksi = new javax.swing.JMenu();
        menuItemSewaKamar = new javax.swing.JMenuItem();
        menuItemBayarKamar = new javax.swing.JMenuItem();
        menuDeposit = new javax.swing.JMenu();
        menuItemDeposit = new javax.swing.JMenuItem();
        menuItemRefund = new javax.swing.JMenuItem();
        menuAkses = new javax.swing.JMenu();
        menuItemGroup = new javax.swing.JMenuItem();
        menuItemPengguna = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        menuItemPassword = new javax.swing.JMenuItem();
        menuReport = new javax.swing.JMenu();
        menuJurnal = new javax.swing.JMenu();
        menuItemJurnalTanggal = new javax.swing.JMenuItem();
        menuItemJurnalKos = new javax.swing.JMenuItem();
        menuItemJurnalKamar = new javax.swing.JMenuItem();
        menuItemBayarKamarReport = new javax.swing.JMenuItem();
        menuItemDepositReport = new javax.swing.JMenuItem();
        menuItemPenghuniKamarReport = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);

        menuApplikasi.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/home.jpg"))); // NOI18N
        menuApplikasi.setText("Aplikasi");

        menuItemKeluar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/keluar.jpg"))); // NOI18N
        menuItemKeluar.setText("Keluar Pengguna");
        menuItemKeluar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemKeluarActionPerformed(evt);
            }
        });
        menuApplikasi.add(menuItemKeluar);

        menuItemTutup.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/tutup.jpg"))); // NOI18N
        menuItemTutup.setText("Tutup Aplikasi");
        menuItemTutup.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemTutupActionPerformed(evt);
            }
        });
        menuApplikasi.add(menuItemTutup);

        jMenuBar1.add(menuApplikasi);

        menuMaster.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/master.jpg"))); // NOI18N
        menuMaster.setText("Data Master");

        menuItemKos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/kos.jpg"))); // NOI18N
        menuItemKos.setText("Kos");
        menuItemKos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemKosActionPerformed(evt);
            }
        });
        menuMaster.add(menuItemKos);

        menuItemKamar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/kamar.jpg"))); // NOI18N
        menuItemKamar.setText("Kamar");
        menuItemKamar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemKamarActionPerformed(evt);
            }
        });
        menuMaster.add(menuItemKamar);

        menuItemFasilitas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/fasilitas.jpg"))); // NOI18N
        menuItemFasilitas.setText("Fasilitas");
        menuItemFasilitas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemFasilitasActionPerformed1(evt);
            }
        });
        menuMaster.add(menuItemFasilitas);

        menuItemInventory.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/invetory.jpg"))); // NOI18N
        menuItemInventory.setText("Inventory");
        menuItemInventory.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemInventoryActionPerformed(evt);
            }
        });
        menuMaster.add(menuItemInventory);

        menuItemPenghuni.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/penghuni.jpg"))); // NOI18N
        menuItemPenghuni.setText("Penghuni");
        menuItemPenghuni.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemPenghuniActionPerformed(evt);
            }
        });
        menuMaster.add(menuItemPenghuni);
        menuMaster.add(jSeparator2);

        menuItemGLAccount.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/account.jpg"))); // NOI18N
        menuItemGLAccount.setText("GL Account");
        menuItemGLAccount.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemGLAccountActionPerformed(evt);
            }
        });
        menuMaster.add(menuItemGLAccount);

        jMenuBar1.add(menuMaster);

        menuTransaksi.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/transaksi.jpg"))); // NOI18N
        menuTransaksi.setText("Transaksi");

        menuItemSewaKamar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/kamar.jpg"))); // NOI18N
        menuItemSewaKamar.setText("Sewa Kamar");
        menuItemSewaKamar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemSewaKamarActionPerformed(evt);
            }
        });
        menuTransaksi.add(menuItemSewaKamar);

        menuItemBayarKamar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/pembayaran.jpg"))); // NOI18N
        menuItemBayarKamar.setText("Bayar Kamar");
        menuItemBayarKamar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemBayarKamarActionPerformed(evt);
            }
        });
        menuTransaksi.add(menuItemBayarKamar);

        menuDeposit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/deposit.jpg"))); // NOI18N
        menuDeposit.setText("Deposit");

        menuItemDeposit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/pembayaran.jpg"))); // NOI18N
        menuItemDeposit.setText("Bayar");
        menuItemDeposit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemDepositActionPerformed(evt);
            }
        });
        menuDeposit.add(menuItemDeposit);

        menuItemRefund.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/refund.jpg"))); // NOI18N
        menuItemRefund.setText("Refund");
        menuItemRefund.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemRefundActionPerformed(evt);
            }
        });
        menuDeposit.add(menuItemRefund);

        menuTransaksi.add(menuDeposit);

        jMenuBar1.add(menuTransaksi);

        menuAkses.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/hak_akses.jpg"))); // NOI18N
        menuAkses.setText("Hak Akses");

        menuItemGroup.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/group.jpg"))); // NOI18N
        menuItemGroup.setText("Group");
        menuItemGroup.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemGroupActionPerformed(evt);
            }
        });
        menuAkses.add(menuItemGroup);

        menuItemPengguna.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/pengguna.jpg"))); // NOI18N
        menuItemPengguna.setText("Pengguna");
        menuItemPengguna.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemPenggunaActionPerformed(evt);
            }
        });
        menuAkses.add(menuItemPengguna);
        menuAkses.add(jSeparator1);

        menuItemPassword.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/password.jpg"))); // NOI18N
        menuItemPassword.setText("Password");
        menuItemPassword.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemPasswordActionPerformed(evt);
            }
        });
        menuAkses.add(menuItemPassword);

        jMenuBar1.add(menuAkses);

        menuReport.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/report.jpg"))); // NOI18N
        menuReport.setText("Report");

        menuJurnal.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/jurnal.jpg"))); // NOI18N
        menuJurnal.setText("Jurnal");

        menuItemJurnalTanggal.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/process.jpg"))); // NOI18N
        menuItemJurnalTanggal.setText("Tanggal");
        menuItemJurnalTanggal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemJurnalTanggalActionPerformed(evt);
            }
        });
        menuJurnal.add(menuItemJurnalTanggal);

        menuItemJurnalKos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/kos.jpg"))); // NOI18N
        menuItemJurnalKos.setText("Kos");
        menuItemJurnalKos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemJurnalKosActionPerformed(evt);
            }
        });
        menuJurnal.add(menuItemJurnalKos);

        menuItemJurnalKamar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/kamar.jpg"))); // NOI18N
        menuItemJurnalKamar.setText("Kamar");
        menuItemJurnalKamar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemJurnalKamarActionPerformed(evt);
            }
        });
        menuJurnal.add(menuItemJurnalKamar);

        menuReport.add(menuJurnal);

        menuItemBayarKamarReport.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/pembayaran.jpg"))); // NOI18N
        menuItemBayarKamarReport.setText("Bayar Kamar");
        menuItemBayarKamarReport.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemBayarKamarReportActionPerformed(evt);
            }
        });
        menuReport.add(menuItemBayarKamarReport);

        menuItemDepositReport.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/deposit.jpg"))); // NOI18N
        menuItemDepositReport.setText("Deposit");
        menuItemDepositReport.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemDepositReportActionPerformed(evt);
            }
        });
        menuReport.add(menuItemDepositReport);

        menuItemPenghuniKamarReport.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/ivanbiz/ui/icon/penghuni.jpg"))); // NOI18N
        menuItemPenghuniKamarReport.setText("History Penghuni Kamar");
        menuItemPenghuniKamarReport.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuItemPenghuniKamarReportActionPerformed(evt);
            }
        });
        menuReport.add(menuItemPenghuniKamarReport);

        jMenuBar1.add(menuReport);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(layeredPane, javax.swing.GroupLayout.DEFAULT_SIZE, 810, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(layeredPane, javax.swing.GroupLayout.DEFAULT_SIZE, 582, Short.MAX_VALUE)
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-818)/2, (screenSize.height-638)/2, 818, 638);
    }// </editor-fold>//GEN-END:initComponents

    private void menuItemKeluarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemKeluarActionPerformed
        dispose();
        new LoginDialog().setVisible(true);
    }//GEN-LAST:event_menuItemKeluarActionPerformed

    private void menuItemTutupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemTutupActionPerformed
        System.exit(0);
    }//GEN-LAST:event_menuItemTutupActionPerformed

    private void menuItemPenggunaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemPenggunaActionPerformed
//        jLayeredPane1.removeAll();
//        jLayeredPane1.repaint();
//        JInternalFrame jInternalFrame = new JInternalFrame();
//        jInternalFrame.setSize(600, 400);
//        Dimension parentSize = jLayeredPane1.getSize();
//        Dimension childSize = jInternalFrame.getSize();
//        jInternalFrame.setLocation((parentSize.width - childSize.width) / 2, (parentSize.height - childSize.height) / 2);
//        jInternalFrame.add(new PenggunaPanel());
//        jInternalFrame.setClosable(true);
//        jInternalFrame.setVisible(true);
//        jLayeredPane1.add(jInternalFrame);

        layeredPane.removeAll();
        layeredPane.repaint();
        PenggunaPanel penggunaPanel = new PenggunaPanel();
        penggunaPanel.setSize(layeredPane.getSize());
        penggunaPanel.setVisible(true);
        layeredPane.add(penggunaPanel);
    }//GEN-LAST:event_menuItemPenggunaActionPerformed

    private void menuItemPenghuniActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemPenghuniActionPerformed
        layeredPane.removeAll();
        layeredPane.repaint();
        PenghuniPanel penghuniPanel = new PenghuniPanel();
        penghuniPanel.setSize(layeredPane.getSize());
        penghuniPanel.setVisible(true);
        layeredPane.add(penghuniPanel);
    }//GEN-LAST:event_menuItemPenghuniActionPerformed

    private void menuItemKamarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemKamarActionPerformed
        layeredPane.removeAll();
        layeredPane.repaint();
        KamarPanel kamarPanel = new KamarPanel();
        kamarPanel.setSize(layeredPane.getSize());
        kamarPanel.setVisible(true);
        layeredPane.add(kamarPanel);
    }//GEN-LAST:event_menuItemKamarActionPerformed

    private void menuItemGroupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemGroupActionPerformed
        layeredPane.removeAll();
        layeredPane.repaint();
        GroupPanel groupPanel = new GroupPanel();
        groupPanel.setSize(layeredPane.getSize());
        groupPanel.setVisible(true);
        layeredPane.add(groupPanel);
    }//GEN-LAST:event_menuItemGroupActionPerformed

    private void menuItemPasswordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemPasswordActionPerformed
        layeredPane.removeAll();
        layeredPane.repaint();
        JDialog jDialog = new JDialog();
        jDialog.setModal(true);
        jDialog.setSize(335, 215);
        jDialog.add(new PasswordPanel());
        jDialog.setLocationRelativeTo(null);
        jDialog.setVisible(true);
    }//GEN-LAST:event_menuItemPasswordActionPerformed

    private void menuItemGLAccountActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemGLAccountActionPerformed
        layeredPane.removeAll();
        layeredPane.repaint();
        GLAccountPanel glAccountPanel = new GLAccountPanel();
        glAccountPanel.setSize(layeredPane.getSize());
        glAccountPanel.setVisible(true);
        layeredPane.add(glAccountPanel);
    }//GEN-LAST:event_menuItemGLAccountActionPerformed

    private void menuItemInventoryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemInventoryActionPerformed
        layeredPane.removeAll();
        layeredPane.repaint();
        InventoryPanel inventoryPanel = new InventoryPanel();
        inventoryPanel.setSize(layeredPane.getSize());
        inventoryPanel.setVisible(true);
        layeredPane.add(inventoryPanel);
    }//GEN-LAST:event_menuItemInventoryActionPerformed

    private void menuItemKosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemKosActionPerformed
        layeredPane.removeAll();
        layeredPane.repaint();
        KosPanel kosPanel = new KosPanel();
        kosPanel.setSize(layeredPane.getSize());
        kosPanel.setVisible(true);
        layeredPane.add(kosPanel);
    }//GEN-LAST:event_menuItemKosActionPerformed

    private void menuItemFasilitasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemFasilitasActionPerformed
        layeredPane.removeAll();
        layeredPane.repaint();
        FasilitasPanel fasilitasPanel = new FasilitasPanel();
        fasilitasPanel.setSize(layeredPane.getSize());
        fasilitasPanel.setVisible(true);
        layeredPane.add(fasilitasPanel);
    }//GEN-LAST:event_menuItemFasilitasActionPerformed

    private void menuItemDepositActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemDepositActionPerformed
        layeredPane.removeAll();
        layeredPane.repaint();
        JDialog jDialog = new JDialog();
        jDialog.setModal(true);
        jDialog.setSize(425, 280);
        jDialog.add(new DepositBayarPanel(jDialog));
        jDialog.setLocationRelativeTo(null);
        jDialog.setVisible(true);
    }//GEN-LAST:event_menuItemDepositActionPerformed

    private void menuItemFasilitasActionPerformed1(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemFasilitasActionPerformed1
        layeredPane.removeAll();
        layeredPane.repaint();
        FasilitasPanel fasilitasPanel = new FasilitasPanel();
        fasilitasPanel.setSize(layeredPane.getSize());
        fasilitasPanel.setVisible(true);
        layeredPane.add(fasilitasPanel);
    }//GEN-LAST:event_menuItemFasilitasActionPerformed1

    private void menuItemSewaKamarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemSewaKamarActionPerformed
        layeredPane.removeAll();
        layeredPane.repaint();
        SewaKamarPanel sewaKamarPanel = new SewaKamarPanel();
        sewaKamarPanel.setSize(layeredPane.getSize());
        sewaKamarPanel.setVisible(true);
        layeredPane.add(sewaKamarPanel);
    }//GEN-LAST:event_menuItemSewaKamarActionPerformed

    private void menuItemBayarKamarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemBayarKamarActionPerformed
        layeredPane.removeAll();
        layeredPane.repaint();
        JDialog jDialog = new JDialog();
        jDialog.setModal(true);
        jDialog.setSize(425, 575);
        jDialog.add(new PembayaranPanel(jDialog));
        jDialog.setLocationRelativeTo(null);
        jDialog.setVisible(true);
    }//GEN-LAST:event_menuItemBayarKamarActionPerformed

    private void menuItemRefundActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemRefundActionPerformed
        layeredPane.removeAll();
        layeredPane.repaint();
        JDialog jDialog = new JDialog();
        jDialog.setModal(true);
        jDialog.setSize(425, 230);
        jDialog.add(new DepositRefundPanel(jDialog));
        jDialog.setLocationRelativeTo(null);
        jDialog.setVisible(true);
    }//GEN-LAST:event_menuItemRefundActionPerformed

    private void menuItemBayarKamarReportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemBayarKamarReportActionPerformed
        layeredPane.removeAll();
        layeredPane.repaint();
        PembayaranReportPanel pembayaranReportPanel = new PembayaranReportPanel();
        pembayaranReportPanel.setSize(layeredPane.getSize());
        pembayaranReportPanel.setVisible(true);
        layeredPane.add(pembayaranReportPanel);
    }//GEN-LAST:event_menuItemBayarKamarReportActionPerformed

    private void menuItemDepositReportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemDepositReportActionPerformed
        layeredPane.removeAll();
        layeredPane.repaint();
        DepositReportPanel depositReportPanel = new DepositReportPanel();
        depositReportPanel.setSize(layeredPane.getSize());
        depositReportPanel.setVisible(true);
        layeredPane.add(depositReportPanel);
    }//GEN-LAST:event_menuItemDepositReportActionPerformed

    private void menuItemPenghuniKamarReportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemPenghuniKamarReportActionPerformed
        layeredPane.removeAll();
        layeredPane.repaint();
        PenghuniKamarReportPanel penghuniKamarReportPanel = new PenghuniKamarReportPanel();
        penghuniKamarReportPanel.setSize(layeredPane.getSize());
        penghuniKamarReportPanel.setVisible(true);
        layeredPane.add(penghuniKamarReportPanel);
    }//GEN-LAST:event_menuItemPenghuniKamarReportActionPerformed

    private void menuItemJurnalTanggalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemJurnalTanggalActionPerformed
        layeredPane.removeAll();
        layeredPane.repaint();
        JDialog jDialog = new JDialog();
        jDialog.setModal(true);
        jDialog.setSize(335, 215);
        jDialog.add(new JurnalPanel());
        jDialog.setLocationRelativeTo(null);
        jDialog.setVisible(true);
    }//GEN-LAST:event_menuItemJurnalTanggalActionPerformed

    private void menuItemJurnalKosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemJurnalKosActionPerformed
        layeredPane.removeAll();
        layeredPane.repaint();
        JDialog jDialog = new JDialog();
        jDialog.setModal(true);
        jDialog.setSize(400, 260);
        jDialog.add(new JurnalKosPanel());
        jDialog.setLocationRelativeTo(null);
        jDialog.setVisible(true);
    }//GEN-LAST:event_menuItemJurnalKosActionPerformed

    private void menuItemJurnalKamarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemJurnalKamarActionPerformed
        layeredPane.removeAll();
        layeredPane.repaint();
        JDialog jDialog = new JDialog();
        jDialog.setModal(true);
        jDialog.setSize(400, 310);
        jDialog.add(new JurnalKosKamarPanel());
        jDialog.setLocationRelativeTo(null);
        jDialog.setVisible(true);
    }//GEN-LAST:event_menuItemJurnalKamarActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JPopupMenu.Separator jSeparator2;
    private javax.swing.JLayeredPane layeredPane;
    private javax.swing.JMenu menuAkses;
    private javax.swing.JMenu menuApplikasi;
    private javax.swing.JMenu menuDeposit;
    private javax.swing.JMenuItem menuItemBayarKamar;
    private javax.swing.JMenuItem menuItemBayarKamarReport;
    private javax.swing.JMenuItem menuItemDeposit;
    private javax.swing.JMenuItem menuItemDepositReport;
    private javax.swing.JMenuItem menuItemFasilitas;
    private javax.swing.JMenuItem menuItemGLAccount;
    private javax.swing.JMenuItem menuItemGroup;
    private javax.swing.JMenuItem menuItemInventory;
    private javax.swing.JMenuItem menuItemJurnalKamar;
    private javax.swing.JMenuItem menuItemJurnalKos;
    private javax.swing.JMenuItem menuItemJurnalTanggal;
    private javax.swing.JMenuItem menuItemKamar;
    private javax.swing.JMenuItem menuItemKeluar;
    private javax.swing.JMenuItem menuItemKos;
    private javax.swing.JMenuItem menuItemPassword;
    private javax.swing.JMenuItem menuItemPengguna;
    private javax.swing.JMenuItem menuItemPenghuni;
    private javax.swing.JMenuItem menuItemPenghuniKamarReport;
    private javax.swing.JMenuItem menuItemRefund;
    private javax.swing.JMenuItem menuItemSewaKamar;
    private javax.swing.JMenuItem menuItemTutup;
    private javax.swing.JMenu menuJurnal;
    private javax.swing.JMenu menuMaster;
    private javax.swing.JMenu menuReport;
    private javax.swing.JMenu menuTransaksi;
    // End of variables declaration//GEN-END:variables

    private void renderMenuAkses(Pengguna pengguna) {
        try {
            AksesMatrixDAO aksesMatrixDAO = new AksesMatrixDAOImpl();
            List<AksesMatrix> listAksesMatrix = aksesMatrixDAO.getDataByEquals(AksesMatrix.class, "groups.id", pengguna.getGroups().getId());
            GlobalSession.setPengguna(pengguna);
            GlobalSession.setListAksesMatrix(listAksesMatrix);
            menuItemPenghuni.setEnabled(MenuAksesConstant.validate(MenuAksesConstant.LIHAT_PENGHUNI, listAksesMatrix));
            menuItemKamar.setEnabled(MenuAksesConstant.validate(MenuAksesConstant.LIHAT_KAMAR, listAksesMatrix));
            menuItemInventory.setEnabled(MenuAksesConstant.validate(MenuAksesConstant.LIHAT_INVENTORY, listAksesMatrix));
            menuItemGLAccount.setEnabled(MenuAksesConstant.validate(MenuAksesConstant.LIHAT_GLACCOUNT, listAksesMatrix));
            menuItemGroup.setEnabled(MenuAksesConstant.validate(MenuAksesConstant.LIHAT_GROUP, listAksesMatrix));
            menuItemPengguna.setEnabled(MenuAksesConstant.validate(MenuAksesConstant.LIHAT_PENGGUNA, listAksesMatrix));
            menuItemPassword.setEnabled(MenuAksesConstant.validate(MenuAksesConstant.LIHAT_PASSWORD, listAksesMatrix));
            menuJurnal.setEnabled(MenuAksesConstant.validate(MenuAksesConstant.LIHAT_JURNAL, listAksesMatrix));
        } catch (Exception ex) {
            Logger.getLogger(AppFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
